package org.example.demo2_lishi.one;

import org.example.demo2_lishi.one.Quadrilateral;

/**
 * 长方形
 * @author lemon
 */
public class Rectangle implements Quadrilateral {
    private double length;
    private double width;

    public void setWidth(double width) {
        this.width = width;
    }

    public void setLength(double length) {
        this.length = length;
    }

    @Override
    public double getLength() {
        return length;
    }

    @Override
    public double getWidth() {
        return width;
    }

    @Override
    public void getArea() {
        double area = length * width ;
        System.out.println("面积为: "+ area);
    }

    @Override
    public void getPerimeter() {
        double perimeter = (length + width) * 2 ;
        System.out.println("周长为: "+ perimeter);
    }
}
